home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-13
/
me_cd22.zip
/
MUTT2.ZIP
/
CASE.MUT
< prev
next >
Wrap
Lisp/Scheme
|
1992-04-27
|
2KB
|
63 lines
;; case.mut
;; Case Conversion Routines.
;; Should be the same routine names and functionality as GNU Emacs.
;; Differences:
;; If a mark is in the region being cased, it will be moved to the front
;; of the region because the region is deleted ie I don't change the
;; text in place.
;; C Durland 2/91 Public Domain
(include me2.h)
(const
LOWER-CASE 0
UPPER-CASE 1
CAPITALIZE 2
)
(defun MAIN
{
(bind-to-key "downcase-region" "C-xC-l")
(bind-to-key "upcase-region" "C-xC-u")
(bind-to-key "downcase-word" "M-l")
(bind-to-key "upcase-word" "M-u")
(bind-to-key "capitalize-word" "M-c")
})
(defun
case-region (int op mark1 mark2) HIDDEN
{
(int bag)
(byte type)(small-int left-edge width height)(int size) ;; RegionInfo
(region-stats (loc type) mark1 mark2 TRUE)
(bag (create-bag))
(append-to-bag bag APPEND-CHARACTERS size)
(case-bag op bag)
(arg-prefix size)(delete-character)
(insert-bag bag)
(free-bag bag)
}
downcase-region { (case-region LOWER-CASE THE-DOT THE-MARK) }
upcase-region { (case-region UPPER-CASE THE-DOT THE-MARK) }
capitalize-region { (case-region CAPITALIZE THE-DOT THE-MARK) }
)
(defun
case-word (int n op)
{
(int mark1 mark2)
(mark1 (create-mark)) (mark2 (create-mark))
(set-mark mark1)
(arg-prefix n)(next-word)(set-mark mark2)
(case-region op mark1 mark2)
(free-mark mark1 mark2)
}
downcase-word { (case-word (arg-prefix) LOWER-CASE) }
upcase-word { (case-word (arg-prefix) UPPER-CASE) }
capitalize-word { (case-word (arg-prefix) CAPITALIZE) }
)